package com.aspose.cells.a.d;

import com.aspose.cells.ImageFormat;
import java.util.HashMap;

class zbk {
   private static HashMap b = new HashMap();

   public static void a(com.aspose.cells.b.a.b.zj var0, com.aspose.cells.b.a.d.zm var1, int var2) {
      assert var0 != null;

      assert var1 != null;

      assert var2 >= 0 && var2 <= 100;

      try {
         zbn.a(var0, var1, (long)var2);
      } catch (Exception var4) {
         com.aspose.cells.a.e.zf.a((Throwable)var4);
      }

   }

   public static zfy a(com.aspose.cells.b.a.b.zj var0, com.aspose.cells.b.a.d.zm var1, int var2, boolean var3) {
      assert var0 != null;

      assert var1 != null;

      if (b(var2) && ((com.aspose.cells.b.a.b.zj)var0).c() != 196865) {
         var0 = a((com.aspose.cells.b.a.b.za)var0);
      }

      com.aspose.cells.b.a.b.b.zd var4 = a(var2, var3);
      com.aspose.cells.b.a.b.b.ze var5 = a(ImageFormat.getTiff());
      zfy var6 = new zfy();
      var6.a((com.aspose.cells.b.a.b.zj)var0);
      var6.a(var2);
      var6.a(var4);
      return var6;
   }

   private static com.aspose.cells.b.a.b.za a(com.aspose.cells.b.a.b.za var0) {
      return var0;
   }

   private static com.aspose.cells.b.a.b.b.zd a(int var0, boolean var1) {
      com.aspose.cells.b.a.b.b.zc var2 = new com.aspose.cells.b.a.b.b.zc(com.aspose.cells.b.a.b.b.zb.c, (long)a(var0));
      if (var1) {
         com.aspose.cells.b.a.b.b.zd var3 = new com.aspose.cells.b.a.b.b.zd(2);
         var3.a()[0] = new com.aspose.cells.b.a.b.b.zc(com.aspose.cells.b.a.b.b.zb.g, 18L);
         var3.a()[1] = var2;
         return var3;
      } else {
         return null;
      }
   }

   private static int a(int var0) {
      return (Integer)b.get(var0);
   }

   private static com.aspose.cells.b.a.b.b.ze a(ImageFormat var0) {
      com.aspose.cells.b.a.b.b.ze[] var1 = com.aspose.cells.b.a.b.b.ze.a();

      for(int var2 = 0; var2 < var1.length; ++var2) {
         if (com.aspose.cells.b.a.zh.a(var1[var2].b(), var0.a())) {
            return var1[var2];
         }
      }

      throw new IllegalArgumentException("Cannot find a codec for " + var0 + ".");
   }

   private static boolean b(int var0) {
      switch(var0) {
      case 2:
      case 3:
      case 4:
         return true;
      default:
         return false;
      }
   }

   static {
      b.put(1, 6);
      b.put(2, 5);
      b.put(5, 2);
      b.put(3, 3);
      b.put(4, 4);
   }
}
